package com.yunquan.ohana.ui.calendar.profiles

import android.app.Application
import android.os.Bundle
import com.yunquan.ohana.base.binding.command.BindingAction
import com.yunquan.ohana.base.binding.command.BindingCommand
import com.yunquan.ohana.base.ui.BaseViewModel
import com.yunquan.ohana.entity.UserManager
import com.yunquan.ohana.ui.calendar.profiles.list.ProfilesListActivity
import com.yunquan.ohana.utils.SPUtils

class ProfilesViewModel(application: Application) : BaseViewModel(application) {

    var mDeviceId: String? = null
    var userType: Boolean = false
    val onDoneClick = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            SPUtils.put("isProfiles_${UserManager.instance.getUser()?.id}_${mDeviceId}", true)
            val bundle = Bundle()
            bundle.putString("deviceId", mDeviceId)
            bundle.putBoolean("userType", userType)
            startActivity(ProfilesListActivity::class.java, bundle)
            finish()
        }
    })
}